package com.spring2mysql;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class TeacherService {
	
	//得到的是一个代理对象
	@Resource
	private TeacherDao dao;
	
	
	
	@Transactional(readOnly=false)
	public int insert(TeacherEntity entity){
		
		return dao.insert(entity);
		
	}
	
	@Transactional
	public List<TeacherEntity> fingAll(){
		
		List<TeacherEntity> list=new ArrayList<TeacherEntity>();
		List<TeacherEntity> fingAll = dao.fingAll();
		return fingAll;
		
	}

}
